package cn.tedu.sp04.order.feign;

import cn.tedu.sp01.pojo.User;
import cn.tedu.web.util.JsonResult;
import org.springframework.stereotype.Component;

@Component
public class UserClientFB implements UserClient{
    @Override
    public JsonResult<User> getUser(Integer userId) {
        //模拟返回缓存数据
        if (Math.random()<0.5){
           User u= new User(8, "缓存用户6", "缓存密码6");
           return JsonResult.ok().data(u);
        }
        return JsonResult.err("获取用户失败");
    }

    @Override
    public JsonResult<?> addScore(Integer userId, Integer score) {
        return JsonResult.err("增加用户失败");
    }
}
